package com.pro.xwt.rest.controller;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pro.xwt.common.model.BTemplate;
import com.pro.xwt.common.model.RTempFlow;
import com.pro.xwt.common.service.BTemplateService;
import com.pro.xwt.common.service.RTempFlowService;
import com.pro.xwt.rest.ResponseResult;

@Controller
@RequestMapping("/templates")
public class BTemplateController {
	@Autowired
	BTemplateService btTemplateService;
    @Autowired
    RTempFlowService rTempFlowService;

	/**
	 * 模版流程查询接口
	 * 
	 * @param bTemplate
	 * @return
	 */
	@RequestMapping(method = { RequestMethod.GET }, value = "/{id}/tempFlows")
	@ResponseBody
	public ResponseResult getTempFlowsById(@PathVariable String id) {
		 List<RTempFlow> be = rTempFlowService.selectRTempFlowByBTemplate(id);
		return ResponseResult.success("获取资源成功", be);
	}

	/**
	 * 项目模板查询接口
	 * @param bTemplate
	 * @return
	 */
	@RequestMapping(method = { RequestMethod.GET }, value = "")
	@ResponseBody
	public ResponseResult get() {
		List<BTemplate> list = btTemplateService.queryListAll(null);
		return ResponseResult.success("获取资源成功", list);
	}

/*	*//**
	 * 查找多个模板
	 * 
	 * @param bTemplate
	 * @return
	 *//*
	@RequestMapping(method = { RequestMethod.GET }, value = "/search")
	@ResponseBody
	public ResponseResult search(@RequestParam Map<String, Object> map) {
		List<BTemplate> list = btTemplateService.queryListAll(map);
		return ResponseResult.success("获取资源成功", list);
	}*/
	
	

}